package gov.dhs.cis.soa.data;

import gov.dhs.cis.soa.Constants;
import gov.dhs.cis.soa.Utils;
import gov.dhs.cis.soa.Constants.EntityType;

import java.sql.Timestamp;


public class IntegrationComp extends AbstractSOAData {
	public static final String STEREO_TYPE = "Hosting Config";
	
	public int id;
	public String name;
	public String wipt;
	public String stereoType;
	public transient String supported;
	public transient String defination;
	public transient String designAspects;
	public String intSWPkg;
	public String buildSW;
	public String release;
	public String security;
	public String securityConfig;

//	public transient List<IntegrationSW> intSWPkgs = null;
//	public transient List<IntegrationSW> buildSWPkgs = null;
//	public transient List<SecurityComp> secCapabilities = null;
	
	public transient Timestamp createdDt = new Timestamp(System.currentTimeMillis());
	public Description desc;

	@Override
	public String toString() {
		String ret = "IntegrationComp [id=" + id + ", name=" + name + ", Desc = " + desc + "] ";
		return ret;
	}

	public void createDescription() {
		StringBuffer txt = new StringBuffer();
		if(Utils.isEmpty(supported))
			supported = "";
		txt.append(Constants.NL+"Supports = " + supported);
		if(Utils.isEmpty(defination))
			defination = "";
		txt.append(Constants.NL+"Definition = " + defination);
		if(Utils.isEmpty(designAspects))
			designAspects = "";
		txt.append(Constants.NL+"Design Aspects = " + designAspects);
		
		desc = Utils.prepareDescObj(txt.toString(), EntityType.INTUC);
	}
	
/*
	public void addSWPkg(IntegrationSW swPkg) {
		if(swPkg == null)
			return;
		if(intSWPkgs == null)
			intSWPkgs = new ArrayList<IntegrationSW>();
		intSWPkgs.add(swPkg);
	}
	public void addBuildSWPkg(IntegrationSW swPkg) {
		if(swPkg == null)
			return;
		if(buildSWPkgs == null)
			buildSWPkgs = new ArrayList<IntegrationSW>();
		buildSWPkgs.add(swPkg);
	}
	public void addSecurityComp(SecurityComp secObj) {
		if(secObj == null)
			return;
		if(secCapabilities == null)
			secCapabilities = new ArrayList<SecurityComp>();
		secCapabilities.add(secObj);
	}
*/
	
//	public static String getUMLId(int entityId) {
//	return EntityType.INTUC + "_" + entityId;
//}

	@Override
	public long getId() {
		return id;
	}
	@Override
	public String getHashableId() {
		return name;
	}

	@Override
	public EntityType getUMLType() {
		return EntityType.INTUC;
	}
}

